package com.zyh.server.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zyh.server.entity.MiaoshaGoods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zyh.server.vo.MiaoshaGoodsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @author ZYH
 * @description 针对表【t_miaosha_goods】的数据库操作Mapper
 * @createDate 2024-11-18 09:50:32
 * @Entity com.zyh.server.entity.MiaoshaGoods
 */
@Mapper
public interface MiaoshaGoodsMapper extends BaseMapper<MiaoshaGoods> {

	/**
	 * 分页查询秒杀商品详情
	 * @param page  分页信息
	 * @param goodsName 模糊搜索关键字
	 * @return
	 */
	IPage<MiaoshaGoodsVO> selectAllByPage(@Param("page") Page<MiaoshaGoodsVO> page,
	                                      @Param("goodsName") String goodsName);

	/**
	 * 查询一个秒杀商品详情
	 * @param miaoshaGoodsId
	 * @return
	 */
	MiaoshaGoodsVO selectOne(@Param("miaoshaGoodsId") Integer miaoshaGoodsId);

	/**
	 * 秒杀商品库存减一
	 * @param miaoshaGoodsId
	 * @return
	 */
	int reduceStock(@Param("miaoshaGoodsId") Integer miaoshaGoodsId);
}




